﻿<UserControl x:Class="Giraffe.Client.ConversationModule.History.MessageControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Converters="clr-namespace:Giraffe.Client.ConversationModule.Converters"
    >
    <UserControl.Resources>
        <Converters:BooleanToAnyConverter x:Key="isOwnMessageForegroundConverter"
                                          TrueValue="{DynamicResource ownForegroundResource}"
                                          FalseValue="{DynamicResource companionForegroundResource}"/>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <StackPanel Orientation="Horizontal" Grid.Column="0">
            <TextBlock Text="{Binding Path=Time, Converter={StaticResource shortTimeconverter}}"
                           Foreground="{Binding Path=IsOwnMessage, Converter={StaticResource isOwnMessageForegroundConverter}}"
                           FontWeight="DemiBold"/>
            <TextBlock Text=" "/>
            <TextBlock Text="{Binding Path=Sender}"
                           Foreground="{Binding Path=IsOwnMessage, Converter={StaticResource isOwnMessageForegroundConverter}}"
                           FontWeight="DemiBold"/>
            <TextBlock Text=": "/>
        </StackPanel>
        <TextBlock Grid.Column="1"
                   Text="{Binding Path=Text}" 
                   TextWrapping="Wrap" ScrollViewer.CanContentScroll="False"
                   />
    </Grid>
</UserControl>
